<html>
<title>Twitter Mass Follower</title>
<head>
<link href="https://twitter.com/phoenix/favicon.ico" rel="shortcut icon" type="image/x-icon" />

<style type="text/css">
body{
   background: url("http://dl.dropbox.com/u/42331717/image/bg.gif") repeat top center fixed;
   font-family:Droid Serif;
   font-size:16px;
   color:green;
   scrollbar-face-color: #FF0000;
   scrollbar-highlight-color: green;
   scrollbar-shadow-color: #000000;
   scrollbar-3dlight-color: green;
   scrollbar-arrow-color: #FF0000;
   scrollbar-track-color: #cc0000;
   scrollbar-darkshadow-color: green;
}
input,textarea{
   font-family:Droid Serif;
   font-size:13px;
   color:#FF0000;
   background-color: SkyBlue;
   border:2px solid green;
}
input.button, div#facebook-publisher input.button {
  background-color: #617AAC;
  background-image: url(https://twitter.com/phoenix/favicon.ico);
  background-repeat: no-repeat;
  background-position: 4px 2px;
  color: #FFFFFF;
  font-weight: bold;
  border: 1px outset #29447E;
 -moz-border-radius: 5px; border-radius: 5px;
  padding:2px 7px 2px 20px;
  font-family: 'lucida grande',tahoma,verdana,arial,sans-serif;
  cursor: pointer;
  margin-top:5px;
}
input.button:hover, div#facebook-publisher input.button:hover {
  background-color: #011A4C;
  color: yellow;
}
-.work
 {font-weight: bold; color: green;}
-.notwork
 {font-weight: bold;color: red;}
</style>



<script type="text/javascript">
    function countaccounts()
    {
            document.getElementById("count").innerHTML = document.getElementById("twitterids").value.split("\n").length;
    }
</script>
</head>
<center>
<h3>Twitter Mass Follower</h3><br>
@ <input type="text" name="userid" id="userid" placeholder="phyleodacosta" value="" /><br /><br />
<form method="POST" action="">
<textarea cols="50" rows="8" name="twitterids" id="twitterids" placeholder="Username:Password" onkeydown="countaccounts()" onchange="countaccounts()"></textarea><br />
<font id="count" style="font-weight: bold;">0</font> Twitter Ids.<br /><br />
<input class="button" type="submit" value="Follow" id="btn"><br /><br />
</form>
</body>
<footer>
<center>
<a href="https://twitter.com/phyleodacosta" class="twitter-follow-button" data-show-count="true">Follow @phyleodacosta</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</center>
</footer>
<?php

set_time_limit(false);
error_reporting(false);
    function logintotwitter($username, $password)
    {
        $username = trim($username);
        $password = trim($password);
        
        $url = "https://twitter.com/?lang=en";
        $referrer = "https://twitter.com/";
        $cookie = "Trigger.txt";
        
$ch = curl_init();
curl_setopt_array($ch, Array(
        CURLOPT_URL => $url,
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_COOKIEJAR => $cookie,
        CURLOPT_COOKIEFILE => $cookie,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 GTBDFff GTB7.0 (.NET CLR 3.5.30729)',
        CURLOPT_REFERER => $referrer,
        CURLOPT_FOLLOWLOCATION => true,
            ));
        $data = curl_exec ($ch);
        curl_close($ch);

        $pattern = '/<input type=[\'\"]hidden[\'\"] name=[\'\"]authenticity_token[\'\"] value=[\'\"](.*?)[\'\"]/i';
        preg_match($pattern,$data,$match);
        if(count($match)>0)
        {
            $authenticitytoken=$match[1];
        }


        $referrer = $url;

        $url = "https://twitter.com/sessions";

        $postfields = array("session[username_or_email]"=>$username, "session[password]"=>$password, "redirect_after_login"=>"/", "authenticity_token"=>$authenticitytoken, "scribe_log"=>"", "return_to_ssl"=>"true");

$ch = curl_init();
curl_setopt_array($ch, Array(
        CURLOPT_URL => $url,
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_COOKIEJAR => $cookie,
        CURLOPT_COOKIEFILE => $cookie,
        CURLOPT_POST => 1,
        CURLOPT_POSTFIELDS => $postfields,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 GTBDFff GTB7.0 (.NET CLR 3.5.30729)',
        CURLOPT_REFERER => $referrer,
        CURLOPT_FOLLOWLOCATION => true,
            ));
        $data = curl_exec ($ch);
        curl_close($ch);

        if(stristr($data, "Sign out"))
        {
            return 1;
        }
        else
        {
            return 0;
        }
    }
    function follow($userid)
    {
        $userid = trim($userid);
        
        $url = "https://twitter.com/$userid";
        $referrer = "https://twitter.com/";
        $cookie = "Trigger.txt";

$ch = curl_init();
curl_setopt_array($ch, Array(
        CURLOPT_URL => $url,
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_COOKIEJAR => $cookie,
        CURLOPT_COOKIEFILE => $cookie,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 GTBDFff GTB7.0 (.NET CLR 3.5.30729)',
        CURLOPT_REFERER => $referrer,
        CURLOPT_FOLLOWLOCATION => true,
          ));
        $data = curl_exec ($ch);
        curl_close($ch);

        $pattern = '/<input type=[\'\"]hidden[\'\"] value=[\'\"](.*?)[\'\"] name=[\'\"]authenticity_token[\'\"]/i';
        preg_match($pattern,$data,$match);
        if(count($match)>0)
        {
            $authenticitytoken=$match[1];
        }

        $pattern = '/<div class=[\'\"]profile-card-inner[\'\"] data-screen-name=[\'\"]'.$userid.'[\'\"] data-user-id=[\'\"](.*?)[\'\"]>/i';
        preg_match($pattern,$data,$match);
        if(count($match)>0)
        {
            $followid=$match[1];
        }
        
        $url = "https://twitter.com/i/user/follow";
        $referrer = "https://twitter.com/$userid";
        $cookie = "Trigger.txt";

        $postfields = array("authenticity_token"=>$authenticitytoken, "user_id"=>$followid);

        $ch = curl_init();
curl_setopt_array($ch, Array(
        CURLOPT_URL => $url,
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_COOKIEJAR => $cookie,
        CURLOPT_COOKIEFILE => $cookie,
        CURLOPT_POST => 1,
        CURLOPT_POSTFIELDS => $postfields,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 GTBDFff GTB7.0 (.NET CLR 3.5.30729)',
        CURLOPT_REFERER => $referrer,
        CURLOPT_FOLLOWLOCATION => true,
        ));
        $data = curl_exec ($ch);
        curl_close($ch);
    }
    if(count($_POST)>0)
    {
        $twitterlogins = explode("\n", $_POST["twitterids"]);
        $userid = $_POST["userid"];
        $countids = count($twitterlogins);
        for($i=0;$i<$countids;$i++)
        {
            if (!(preg_match("/[a-zA-Z0-9]+/i", $twitterlogins[$i])))
            {
                continue;
            }
            $twittercred = explode(":", $twitterlogins[$i]);
            $loggedin = logintotwitter($twittercred[0], $twittercred[1]);
            if($loggedin == 1)
            {
                follow($userid);
                echo $twittercred[0].":".$twittercred[1]."<br/>";
                flush();
                ob_flush();
            }
            @unlink("Trigger.txt");
        }
    }
?>
